/*
 * PopupUsersWidget.hpp
 *
 *  Created on: Jul 7, 2012
 *      Author: guillou
 */

#ifndef POPUPUSERSWIDGET_HPP_
#define POPUPUSERSWIDGET_HPP_

#include <ui_userswidget.h>
#include <PopupLibTypes.hpp>
#include <PopupUsersManager.hpp>
#include <PopupUsersTableModel.hpp>

class PopupUserProfileFrame;

class PopupUsersWidget :
  public QWidget,
  public PopupUsersObserver,
  private Ui_UsersWidget
{
  Q_OBJECT

public:
  PopupUsersWidget(QWidget *parent = 0,
                   const Popup::UserList & p_filterOut =
                       Popup::EmptyUserList);
  virtual ~PopupUsersWidget();

  // Implementation of PopupUsersObverver
  void userUpdated(const PopupUserExt *p_user,
                   unsigned short p_updateMask,
                   bool p_isNewUser);
  void userStatisticsUpdated(const PopupUserExt *p_user,
                             unsigned short p_updateMask);

  void getSelectedUsers(Popup::UserList & p_users);
  bool hasSelection();
  void displayStatistics(bool p_show);

private slots:
  void slot_loadFriendsList(QString);
  void slot_saveFriendsList();
  void slot_onUnselectAll();
  void slot_customContextMenuRequested(QPoint);

private:
  QWidget *m_parent;
  const Popup::UserList & m_filterOut;
  PopupUsersTableModel m_usersTableModel;
  PopupUserProfileFrame *m_userProfileFrame;
};

#endif /* POPUPUSERSWIDGET_HPP_ */
